package com.zzxx.wechat.dao;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzxx.wechat.entity.ArcteryxLink;
import com.zzxx.wechat.mapper.ArcteryxLinkMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ArcteryxLinkDao extends ServiceImpl<ArcteryxLinkMapper, ArcteryxLink> implements IService<ArcteryxLink> {


    public List<ArcteryxLink> queryBySpuIds(List<String> spuIds) {
        return lambdaQuery()
                .in(ArcteryxLink::getSpuId, spuIds)
                .list();
    }

    public ArcteryxLink queryByUrl(String url) {
        return lambdaQuery()
                .eq(ArcteryxLink::getUrl, url)
                .one();
    }

    public boolean updateReasonById(Integer id, String reason) {
        return lambdaUpdate()
                .set(ArcteryxLink::getReason, reason)
                .eq(ArcteryxLink::getId, id)
                .update();
    }
}
